<template>
  <div class="div1">
    <h2>父子组件</h2>
    <span>{{ car }}</span><br/>
    <span>子组件传递给父组件的值是：{{ toy }}</span>
    <TongXin1Child :car="car" :sendToy="getToy" />
  </div>
</template>
<script setup lang="ts">
import TongXin1Child from './TongXin1Child.vue'
import { ref } from 'vue'

const car = ref('宝马')
const toy = ref('')

const getToy = (value: string) => {
  toy.value = value
}

</script>
<style lang="scss" scoped>
.div1 {
  background-color: #f5f5f5;
  padding: 20px;
  border: 1px solid #eee;
}

</style>
